package com.qdlc.p2p.biz.executer.impl;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.common.constant.LogTplNid;
import com.qdlc.p2p.dal.dto.Account;
import com.qdlc.p2p.dal.dto.AccountLog;

/**
 * 还款奖励
 * 
 * @author cx
 * @version 1.0
 * @since 2014-6-6
 */
@Service
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class RepayDeductAwardExecuter extends DeductAwardExecuter {

	private String accountLogType = LogTplNid.AWARD_DEDUCT;

	@Override
	public String getAccountLogType() {
		return accountLogType;
	}

	@Override
	public void addAccountLog() {
		Global.setTransfer("web_url", WEB_URL);
		Account account = accountDao.findByUserId(super.user.getUserId());
		AccountLog log = new AccountLog(super.user, accountLogType, super.toUser);
		log.setMoney(super.money);
		log.setTotal(account.getTotal());
		log.setUseMoney(account.getUseMoney());
		log.setNoUseMoney(account.getNoUseMoney());
		log.setCollection(account.getCollection());
		log.setRemark("扣除还款奖励" + super.money + "元。");
		
		accountLogDao.save(log);
	}
}
